<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 定义一个学生类型Student
        // 显示如下属性和方法
        //     姓名、年龄、性别、课程分数(html、css、js)
        //     显示个人信息的show方法

        // function Student(name,age,sex,html,css,js){
        //     this.name=name;
        //     this.age=age;
        //     this.sex=sex;
        //     this.html=html;
        //     this.css=css;
        //     this.js=js;
        //     this.show=function(){
        //         console.log("我的姓名是:"+this.name+",年龄:"+this.age+",性别:"+this.sex+",html:"+this.html+",css:"+this.css+",js"+this.js);
        //     };
        // }
        // var stu=new Student("小雨",20,"女",90,89,100);
        // stu.show();
        // var stu2=new Student("小雨伟",30,"女",30,59,80);
        // stu2.show();

        //定义一个分数类型
        function Score(html, css, js) {
            this.html = html;
            this.css = css;
            this.js = js;
        }

        //定义一个学生类型
        function Student(name, age, sex,scores) {//scores是一个形参，将scores看成是一个对象
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.scores=scores;//将scores的值看成是一个对象
            this.show = function () {
                console.log("我的姓名是:" + this.name + ",年龄:" + this.age + ",性别:" + this.sex + ",html:" + this.scores.html + ",css:" + this.scores.css + ",js" + this.scores.js);
            };
        }
        var s=new Score(100,98,87);//s是分数对象
        var stu=new Student("胡宇崴",20,"男",s);//s是一个对象
        console.log(stu);
        stu.show();
    </script>
</body>

</html>